package com.chenliwu.demo.collection.list;

import java.util.ArrayList;
import java.util.List;

/**
 * ArrayList
 *
 * @author chenliwu
 * @since 2023-06-11
 */
public class ArrayListDemo {

    public static void main(String[] args) {
        test1();
    }

    private static void test1() {
        List<String> list = new ArrayList<>();

        list.add("item1");
        list.add("item2");
        list.add("item3");

        for (String item : list) {
            System.out.println(item);
        }
        System.out.println("------------------");

        // 将下标1元素设置为制定值
        list.set(1, "item insert");

        for (String item : list) {
            System.out.println(item);
        }
    }
}
